import { defineComponent } from 'vue'
import { useAuthStore } from '@/stores/auth'

export default defineComponent({
  name: 'Permission',
  props: {
    permission: {
      type: String,
      required: true
    }
  },
  setup(props, { slots }) {
    const authStore = useAuthStore()
    
    const hasPermission = computed(() => {
      return authStore.permissions.includes(props.permission)
    })
    
    return () => hasPermission.value ? slots.default?.() : null
  }
}) 